package com.hongye.backstage.controller;

import com.hongye.backstage.entity.HomeyHouseEntity;
import com.hongye.backstage.entity.HongyeCityEntity;
import com.hongye.backstage.service.HomeyBrokerService;
import com.hongye.backstage.vo.BrokerlistVo;
import com.hongye.common.enu.ResultEnum;
import com.hongye.common.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @progam:hongye-broker
 * @author:江伟
 * @Time:2022/4/20 18:38
 */
@RestController
@RequestMapping("/backstage/broker")
public class HomeyBrokerController {
    @Autowired
    private HomeyBrokerService homeyBrokerService;

    /**
     * 后台 审核管理列表
     * @param parameter 姓名或者手机号
     * @param status 在职状态
     * @return
     */
    @GetMapping("/brokerlist")
    public ResponseResult brokerlist(@RequestParam(value = "parameter",defaultValue = "")String parameter
            ,@RequestParam(value = "status",defaultValue = "0")String status){


        ResponseResult<Object> result = new ResponseResult<>();
        try{
            List<BrokerlistVo> brokerlist=homeyBrokerService.brokerlist(parameter,status);
            result.setSuccess(ResultEnum.SUCCESS.getSuccess());
            result.setCode(ResultEnum.SUCCESS.getCode());
            result.setMessage(ResultEnum.SUCCESS.getMessage());
            result.setData(brokerlist);
            return result;
        }catch (Exception e){
            e.printStackTrace();
            result.setSuccess(ResultEnum.ERROR.getSuccess());
            result.setCode(ResultEnum.ERROR.getCode());
            result.setMessage(ResultEnum.ERROR.getMessage());
            return result;
        }
    }
}
